<script setup>
import { useRequest, useWatch } from '@/hooks';
import { useSelectIns } from '@/store/zdwh.js';
import { getEntInfo } from '@/api/index.js';
import InsForm from './InsForm.vue';

const selectInsStore = useSelectIns();
const [res, loading, run] = useRequest(getEntInfo, { manual: true });

useWatch(
  () => selectInsStore.selectIns,
  n => {
    if (n) run({ enterpriseCode: n.enterpriseCode });
  },
  { deep: true, immediate: true },
);
</script>

<template>
  <div v-loading="loading" class="u-w100 u-h100 u-base-fg">
    <div class="u-fs20 u-fw-b text-center u-pt20 u-pb20">{{ res?.enterprise?.enterpriseName ?? '' }}</div>
    <InsForm :infoData="res ?? {}" />
  </div>
</template>
